package com.cai.servlet.common.user;

import com.cai.dao.DetailedTopicDao;
import com.cai.dao.impl.DetailedTopicDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author RuoLi
 */
@WebServlet(name = "ServletGoUserTopicPage", value = "/common/GoUserTopicPage")
public class ServletGoUserTopicPage extends HttpServlet {
    static String detailedId = null;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        detailedId = req.getParameter("detailedTopicId");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        DetailedTopicDao detailedTopicDao = new DetailedTopicDaoImpl();
        String json = detailedTopicDao.getUserDetailedTopicInfo(Integer.parseInt(detailedId));
        resp.getWriter().write(json);
    }
}
